//https://leetcode.cn/problems/container-with-most-water/
class Solution {
public:
    int maxArea(vector<int>& height) {
        int slow = 0;
        int fast = height.size() - 1;
        int max_v = 0;

        while (slow < fast)
        {
            int v = min(height[slow], height[fast]) * (fast - slow);
            max_v = max(max_v, v);
            if (height[slow] < height[fast]) slow++;
            else    fast--;
        }
        return max_v;
    }
};